Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Task 2: Modify an Existing React/Redux Frontend
Aim
To support icons, I extended our existing React/Redux frontend written in TypeScript.
Software languages
modify the Goal model using TypeScript, integrate an emoji picker and lastly, extend the existing React components and Redux store to enable users to add and change icons
Typescript: Modification of the Goal model. By adding an emoji picker.
React- Extension of the React components.
Redux: The Redux store facility is used to enable users to add and change icons.
Result
GoalManager.tsx: Changes are made to the file.
Steps
File: types.ts
Description:
Add an optional icon field of string type
File: GoalCard.tsx
Description:
In GoalCard.tsx, I've styled an element for the icon and integrated it into the GoalCard component. Now, each card displays its respective icon. This enhances visual consistency and improves user experience. Let me know if you need further details or have any feedback.
Install emoji-mart at v3.0.1
npm install [email protected]
Creation of a reusable wrapper. It uses mode from Redux themeSlice. Additionally it takes an onClick event handler with params: (emoji: BaseEmoji, event: React.MouseEvent) => void
File: EmojiPicker.tsx
Description:
The updated EmojiPicker component now integrates theme selection from the Redux store. Removed preview and skin tone options for simplicity. The component now renders a picker with the selected theme and emits clicked emojis via the provided callback. Styles imported from emoji-mart.css for consistent UI.
File: GoalManager.tsx
Description:
Team, in GoalManager.tsx, I've implemented an emoji picker feature. It appears based on a condition and adjusts its position accordingly. On selection, tasks for handling event propagation, local state updates, and Redux store updates are outlined. Further database integration is planned. Feedback is welcome.
File: GoalManager.tsx
Description:
Team, in the pickEmojiOnClick function of GoalManager.tsx, now on emoji selection, it updates the local state and dispatches Redux action for goal update. Further, database integration is planned. Feedback appreciated.
File: GoalManager.tsx
Description:
Team, in GoalManager.tsx, I've added an "Add icon" button. It triggers an emoji picker to select icons for goals. The icon state now updates dynamically based on goal changes, improving user interaction. Feedback is welcome.
File: GoalManager.tsx
Description:
In GoalManager.tsx, I've introduced a GoalIconContainer styled component that displays a goal's icon when available. It enhances goal visualization and user experience. Feedback is appreciated.
File: GoalIcon.tsx
Description:
In GoalIcon.tsx, I've styled an icon component with a larger font size and cursor pointer. It's wrapped in a button for interaction. This enhances goal representation and encourages user engagement. Feedback welcomed.
Task 3: Modify the Client’s Requests
Aim
Wire together the backend and frontend.
Result
clientRequest.patch
Steps
File: lib.ts
Description:
In lib.ts, I've implemented an async function updateGoal to update goals via API. It utilizes axios to send a PUT request to the specified endpoint with the updated goal object. Returns true on success and false on failure. Feedback appreciated.
File: GoalManager.tsx
Description:
In GoalManager.tsx, I've integrated updateGoalApi from our library to update goals asynchronously on emoji selection. It sends updated goal data to the backend API. Enhances goal management functionality. Feedback is appreciated.